﻿/**********************************************************************
 * @file   OperatorsLoad.h
 * @brief  载荷操作器
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date   2024-12-06
 *********************************************************************/
#ifndef _OperatorsLoad_H
#define _OperatorsLoad_H

#include "FITK_Kernel/FITKCore/FITKActionOperator.h"
#include "FITK_Kernel/FITKCore/FITKOperatorRepo.h"
#include "PickDataProvider/PickedData.h"

namespace ModelOper
{
    /**
     * @brief  载荷操作器
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2024-12-06
     */
    class OperatorsLoad :public Core::FITKActionOperator
    {
        Q_OBJECT;
    public:
        /**
         * @brief  Construct a new Operators Load object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-06
         */
        explicit OperatorsLoad() = default;
        /**
         * @brief  Destroy the Operators Load object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-06
         */
        virtual ~OperatorsLoad() = default;
        /**
         * @brief  执行界面操作
         * @return true     执行成功
         * @return false     执行失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-06
         */
        virtual bool execGUI() override;
        /**
         * @brief  执行读入操作
         * @return true     执行成功
         * @return false     执行失败
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-06
         */
        virtual bool execProfession() override;

    private:
        /**
         * @brief    拾取数据操作
         * @return   bool
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-11
         */
        bool pickDataOper();
        /**
         * @brief    创建载荷操作
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-11
         */
        void createLoadOper();
        /**
         * @brief    修改载荷操作
         * @return   bool
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-11
         */
        bool editLoadOper();
        /**
         * @brief    计算面的位置点坐标
         * @param[i] pickData
         * @param[o] point 点的位置
         * @param[o] elemIndex 单元Index
         * @return   void
         * @author   BaGuijun (baguijun@163.com)
         * @date     2024-11-25
         */
        void calculateFaceLocationPoint(GraphData::PickedFaceData pickData, double* point, int& elemIndex);
        /**
         * @brief    计算梁的位置点坐标
         * @param[i] objID 
         * @param[o] point 
         * @param[i] elemIndex 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2024-12-30
         */
        void calculateBeamLocationPoint(int objID, double* point, int elemIndex);
        /**
         * @brief  计算FE的位置坐标
         * @param[i] elementID 
         * @param[o] point
         * @param[o] nodeID
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-01-17
         */
        void calculateFELocationPoint(int elementID, double* point, int& nodeID);

    private slots:
        /**
         * @brief  拾取数据完成槽
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2024-12-11
         */
        void pickDataFinished();
    };

    // 按钮注册相关操作
    Register2FITKOperatorRepo(actionCreateLoad, OperatorsLoad);
    Register2FITKOperatorRepo(actionEditLoad, OperatorsLoad);
}

#endif